package work;

public class Student{
    private int age,stuID;
    private String name;
    private static int init = 0;

    public Student() {}

    public Student(String name, int age) {
        this.age = age;
        this.name = name;
        this.stuID = ++init;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getStuID() {
        return stuID;
    }

    public void setStuID(int stuID) {
        this.stuID = stuID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "学生的信息为:\n" +
                "年龄：" + age + "\n" +
                "学号：" + stuID + "\n" +
                "姓名：" + name + '\n';
    }
}